<?php $podeEditar = $emissora['situacao_id'] == \App\Model\Entity\Situacao::Aprovada || $emissora['situacao_id'] == \App\Model\Entity\Situacao::Finalizada; ?>

<div class="row content-view">

    <div class="col-md-10 col-md-offset-1 backButton">
        <a href="#"> <h4>
                <button type="button" title="Adicione a longitude" data-placement="bottom" class="btn btn-sm btn-info btn-circle">
                    <i class="fa fa-arrow-left" style="font-size: 12px"></i>
                </button> Voltar</h4></a>
    </div>

    <div class="col-md-10 col-md-offset-1">

        <div class="panel panel-default">
            <div class="panel-heading">
                <h3 class="panel-title text-info">Dados cadastrais da emissora</h3>
            </div>
            <div class="panel-body">
                <fieldset class="form-panel">
                    <div class="col-md-5">
                        <div class="form-group <?php echo isset($errors['cpf_cnpj']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="cpf_cnpj">CNPJ:</label>
                            <input disabled="disabled" autofocus class="form-control" placeholder="ex: 99.999.999/9999-99" name="cpf_cnpj" id="cpf_cnpj" value="<?php echo $emissora['cpf_cnpj']; ?>" />
                        </div>
                        <div class="form-group <?php echo isset($errors['razaosocial']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="razaosocial">Razão Social:</label>
                            <input disabled="disabled" class="form-control" placeholder="Insira a razão social" name="razaosocial" id="razaosocial" value="<?php echo $emissora['razaosocial']; ?>" />
                        </div>
                        <div class="form-group <?php echo isset($errors['nomefantasia']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="nomefantasia">Nome Fantasia:</label>
                            <input disabled="disabled" class="form-control" placeholder="Insira nome fantasia" name="nomefantasia" id="nomefantasia" value="<?php echo $emissora['nomefantasia']; ?>" />
                        </div>
                    </div>
                    <div class="col-md-5 col-md-offset-1">
                        <div class="form-group <?php echo isset($errors['cidade']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="cidade">Cidade:</label>
                            <input disabled="disabled" class="form-control" placeholder="Insira a cidade" name="cidade" id="codigo_abert" value="<?php echo $emissora['cidade']; ?>" />
                        </div>
                        <div class="form-group <?php echo isset($errors['codigo_abert']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="codigo_abert">Código ABERT:</label>
                            <input disabled="disabled" class="form-control" placeholder="Insira o código" name="codigo_abert" id="codigoabert" value="<?php echo $emissora['codigo_abert']; ?>" />
                        </div>
                    </div>
                </fieldset>
                <fieldset class="form-panel">
                    <div class="col-md-5">
                        <div class="form-group <?php echo isset($errors['responsavel_cadastro']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="responsavel_cadastro">Nome:</label>
                            <input disabled="disabled" class="form-control" placeholder="Nome do cadastrante" name="responsavel_cadastro" id="responsavel_cadastro" value="<?php echo $emissora['responsavel_cadastro']; ?>" />
                        </div>
                        <div class="form-group <?php echo isset($errors['departamento_responsavel']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="departamento_responsavel">Departamento:</label>
                            <input disabled="disabled" class="form-control" placeholder="Marca empresarial" name="departamento_responsavel" id="departamento" value="<?php echo $emissora['departamento_responsavel']; ?>" />

                        </div>
                        <div class="form-group <?php echo isset($errors['telefone_responsavel']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="telefone_responsavel">Telefone:</label>
                            <input disabled="disabled" class="form-control" placeholder="Ex: (ddd) xxxx-xxxxl" name="telefone_responsavel" id="telefone" value="<?php echo $emissora['telefone_responsavel']; ?>" />
                        </div>
                    </div>
                    <div class="col-md-5 col-md-offset-1">
                        <div class="form-group <?php echo isset($errors['cargo_responsavel']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="cargo_responsavel">Cargo:</label>
                            <input disabled="disabled" class="form-control" placeholder="Cargo do cadastrante" name="cargo_responsavel" id="cidade" value="<?php echo $emissora['cargo_responsavel']; ?>" />
                        </div>
                        <div class="form-group <?php echo isset($errors['email_responsavel']) ? 'has-error' : ''; ?>">
                            <label class="control-label" for="email_responsavel">Email:</label>
                            <input disabled="disabled" type="email" class="form-control" placeholder="Email do cadastrante" name="email_responsavel" id="email" value="<?php echo $emissora['email_responsavel']; ?>" />
                        </div>
                        <div class="form-group">
                            <label class="control-label" for="celular_responsavel">Celular:</label>
                            <input disabled="disabled" class="form-control" placeholder="Ex: (ddd) xxxx-xxxx" name="celular_responsavel" id="celular" value="<?php echo $emissora['celular_responsavel']; ?>" />
                        </div>
                    </div>
                </fieldset>

            </div>
            <div class="panel-heading">
                <h3 class="panel-title text-info">Dados cadastrais da rádio</h3>
            </div>
            <div class="panel-body"  style="padding-top: 4%">
                <form role="form" enctype="multipart/form-data" method="POST" >
                    <fieldset class="form-panel" <?= $podeEditar ? "" : "disabled" ?>>
                        <div class="col-md-5">
                            <div class="form-group <?php echo isset($errors['nome_empresa']) ? 'has-error' : ''; ?>">
                                <label class="control-label required" for="nome_empresa">Nome da empresa do aplicativo:</label>
                                <input autofocus class="form-control" name="nome_empresa" id="cpf_cnpj" value="<?php echo $emissora['nome_empresa']; ?>" />
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'nome_empresa']); ?>
                            </div>
                            <div class="form-group <?php echo isset($errors['palavra_chave']) ? 'has-error' : ''; ?>">
                                <label class="control-label required" for="palavra_chave">Palavra chave: (Interatividade com o Ouvinte)</label>
                                <input class="form-control" placeholder="Insira a palavra chave"  name="palavra_chave" id="palavra_chave" value="<?php echo $emissora['palavra_chave']; ?>" />
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'palavra_chave']); ?>
                            </div>
                            <div class="form-group <?php echo isset($errors['mensagem_compartilhamento']) ? 'has-error' : ''; ?>">
                                <label class="control-label required" for="palavra_chave">Mensagem de compartilhamento: (Facebook e Twitter)</label>
                                <textarea class="form-control" name="mensagem_compartilhamento" id="mensagem_compartilhamento"><?php echo $emissora['mensagem_compartilhamento']; ?></textarea>
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'mensagem_compartilhamento']); ?>
                            </div>

                            <div class="form-group has-feedback <?php echo isset($errors['facebook']) ? 'has-error' : ''; ?>">
                                <label class="control-label" for="palavra_chave">Facebook:</label>
                                <input class="form-control" placeholder="link do perfil"  name="facebook" id="facebook" value="<?php echo $emissora['facebook']; ?>" />
                                <span class="glyphicon glyphicon-link form-control-feedback text-muted"></span>
                                <button type="button" title="Adicione o link RDS" data-placement="bottom" class="btn btn-sm btn-info btn-circle indexTooltip">
                                    <i class="fa fa-question" style="font-size: 12px"></i>
                                </button>
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'facebook']); ?>
                            </div>

                            <div class="form-group has-feedback <?php echo isset($errors['link_integracao_programacao']) ? 'has-error' : ''; ?>">
                                <label class="control-label" for="link_integracao_programacao">Link da programação:</label>
                                <input class="form-control" placeholder="link da programação"  name="link_integracao_programacao" id="link_integracao_programacao" value="<?php echo $emissora['link_integracao_programacao']; ?>" />
                                <span class="glyphicon glyphicon-link form-control-feedback text-muted"></span>
                                <button type="button" title="Adicione o link da programação" data-placement="bottom" class="btn btn-sm btn-info btn-circle indexTooltip">
                                    <i class="fa fa-question" style="font-size: 12px"></i>
                                </button>
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'link_integracao_programacao']); ?>
                            </div>

                            <div class="form-group <?php echo isset($errors['latitude']) ? 'has-error' : ''; ?>">
                                <label class="control-label required" for="latitude">Latitude:</label>
                                <input class="form-control" placeholder="latitude"  name="latitude" id="latitude" value="<?php echo $emissora['latitude']; ?>" />
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'latitude']); ?>
                            </div>
                            <div class="form-group <?php echo isset($errors['longitude']) ? 'has-error' : ''; ?>">
                                <label class="control-label required" for="longitude">Longitude:</label>
                                <input class="form-control" placeholder="longitude"  name="longitude" id="longitude" value="<?php echo $emissora['longitude']; ?>" />
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'longitude']); ?>
                            </div>
                        </div>
                        <div class="col-md-5 col-md-offset-1">
                            <div class="row">

                                <div class="form-group <?php echo isset($errors['logo']) ? 'has-error' : ''; ?>">
                                    <label class="control-label required col-md-12">Imagem da logo:</label>
                                    <div class="col-md-5">
                                        <div class="thumbnail imgThumb">
                                            <?php
                                            if ($emissora['logo']) {
                                                echo $this->Html->image('upload/' . $emissora['logo'], ['class' => 'img-responsive']);
                                            }
                                            ?>
                                        </div>
                                    </div>
                                    <div class="col-md-6 col-md-offset-1">
                                        <div class="form-group">
                                            <p>
                                                A imagem deverá ser no tamanho 1024x1024 com a extensão .png
                                            </p>
                                            <input type="file" name="submittedfile" id="submittedfile" />
                                        </div>
                                    </div>
                                    <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'logo']); ?>
                                </div>

                            </div>
                            <div class="form-group <?php echo isset($errors['nome_provedor_streaming']) ? 'has-error' : ''; ?>">
                                <label class="control-label required" for="nome_provedor_streaming">Nome do Provedor:</label>
                                <input class="form-control" placeholder="Nome do Provedor"  name="nome_provedor_streaming" id="nome_provedor_streaming" value="<?php echo $emissora['nome_provedor_streaming']; ?>" />
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'nome_provedor_streaming']); ?>
                            </div>

                            <div class="form-group has-feedback <?php echo isset($errors['streaming']) ? 'has-error' : ''; ?>">
                                <label class="control-label required" for="streaming">Link da transmissão:</label>
                                <input class="form-control" placeholder="link da transmissão"  name="streaming" id="streaming" value="<?php echo $emissora['streaming']; ?>" />
                                <span class="glyphicon glyphicon-link form-control-feedback text-muted"></span>
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'streaming']); ?>
                            </div>

                            <div class="form-group">
                                <audio src="<?php echo $emissora['streaming']; ?>" controls></audio>
                            </div>

                            <div class="form-group has-feedback <?php echo isset($errors['twitter']) ? 'has-error' : ''; ?>">
                                <label class="control-label" for="twitter">Twitter:</label>
                                <input class="form-control" placeholder="Link do Twitter"  name="twitter" id="twitter" value="<?php echo $emissora['twitter']; ?>" />
                                <span class="glyphicon glyphicon-link form-control-feedback text-muted"></span>
                                <button type="button" title="Adicione o link do Twitter" data-placement="bottom" class="btn btn-sm btn-info btn-circle indexTooltip">
                                    <i class="fa fa-question" style="font-size: 12px"></i>
                                </button>
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'twitter']); ?>
                            </div>

                            <div class="form-group has-feedback <?php echo isset($errors['link_rds']) ? 'has-error' : ''; ?>">
                                <label class="control-label" for="link_rds">Link RDS:</label>
                                <input class="form-control" placeholder="Link do RDS"  name="link_rds" id="link_rds" value="<?php echo $emissora['link_rds']; ?>" />
                                <span class="glyphicon glyphicon-link form-control-feedback text-muted"></span>
                                <button type="button" title="Adicione o link RDS" data-placement="bottom" class="btn btn-sm btn-info btn-circle indexTooltip">
                                    <i class="fa fa-question" style="font-size: 12px"></i>
                                </button>
                                <?= $this->element('field_errors', [ "errors" => $errors, 'field' => 'link_rds']); ?>
                            </div>
                        </div>
                    </fieldset>

                    <?php if ($podeEditar) { ?>
                        <div class="form-group col-md-11" style="padding-top: 2%">
                            <div class="pull-right">
                                <input type="submit" class="btn btn-info" value="Enviar formulario" />
                            </div>
                        </div>

                        <div class="col-md-12 dashed" style="padding-left: 0%; padding-right: 0%"> </div>

                        <div class="col-md-12">
                            <p style="text-align: center">
                                Os dados marcados com <span class="required-mark">*</span> são obrigatórios, caso contrário o cadastro não poderá ser efetuado.
                            </p>
                        </div>

                    <?php } ?>
                </form>
            </div>
        </div>

    </div>

</div>